package cn.com.shinho.hg.core.base.controller;

import cn.com.shinho.hg.core.base.response.ResponseData;
import cn.com.shinho.hg.core.common.exception.CoreExceptionEnum;
import com.xiaoleilu.hutool.bean.BeanUtil;
import org.springframework.boot.web.servlet.error.DefaultErrorAttributes;
import org.springframework.web.context.request.WebRequest;

import java.util.Map;

/**
 * 重写spring得默认响应提示信息
 *
 * @author Mr.Ye
 * @Date 2018-6-14-下午5:54
 */
public class DefaultHGErrorAttributes extends DefaultErrorAttributes {

    @Override
    public Map<String, Object> getErrorAttributes(WebRequest webRequest, boolean includeStackTrace) {
        return BeanUtil.beanToMap(ResponseData.error(CoreExceptionEnum.SERVICE_ERROR.getMessage()));

    }
}
